<template>
  <div class='ProductOverview wh100'>
    <ul class="menus font30 fl-l">
      <li class="menu" v-for='item,index in menus' :class='menuActiveIndex==index?"menu-active":""' @click='change(index,item.cid)'>{{item.name}}</li>
    </ul>
    <router-link to='/'>
    <div class="homeBtn fl-r bg-style" style='background-image:url(../static/image/homeBtn.png)'>
      <!-- <div class="home-icon"></div> -->
    </div>
  </router-link>
  <div class="clear"></div>
  <ul class='lists po-a'>
    <router-link to='/'>
    <li class='list font16' v-for='item,index in lists'>
      <img src="" alt="">
      <div class="name">HTLKTJELJT225</div>
      <div class="infoBox">
        <span class='price fl-l'>￥198</span> 
        <span class="purchased fl-r">50人已购买</span>
      </div>
    </li>
  </router-link>
</ul>
<div class="next bg-style po-a" style='background-image:url(../static/image/next.png)'></div>
</div>
</template>
<script>
  import ajax from '@/assets/ajax.js'
  export default {
    name:'ProductOverview',
    props: {},
    data() {
      return {
        // 菜单相关
        menus:['眼部','唇部','面部','其他'],//菜单
        menuActiveIndex:0,//当前active
        // 列表相关
        lists:[1,2,3,4,5,6,7,8,9,10,11,12,13],//当前展示产品列表
      }
    },
    beforeCreate() {},
    created() {},
    beforeMount() {},
    computed: {},
    mounted() {
      this.init();
    },
    beforeDestroy() {},
    destroyed() {},
    methods: {
      // 全部商品页面初始化，默认选中第一个种类
      init: function(){
        var _this=this;
        ajax.fetchData('../static/cats.json','get','',function(result){
          // console.log(result);
          _this.menus=result.data;
        });
        ajax.fetchData('../static/cats.json','get','',function(result){
          // console.log(result);
          _this.menus=result.data;
        });
      },
      // 点击menu菜单变化选择
      change: function(index,cid){
        this.menuActiveIndex=index;
        console.log(cid);
      }
    },
    components: {}
  }
</script>
<style scoped>
.ProductOverview{
  padding:0.65rem;
  position: relative;
  box-sizing: border-box;
  background: black;
}
.menu{
  width: 1.7rem;
  height: .46rem;
  float: left;
  margin-right: .35rem;
  border:.02rem solid white;
  line-height: .46rem;
  text-align: center;
}
.menu-active{
  background: #FF126F;
  border:.02rem solid #FF126F !important;
}
.homeBtn{
  width: .9rem;
  height: .9rem;
  /*background: red;*/
}
.lists{
  width: 17.9rem;
  height: 6.9rem;
  top:2.3rem;
  left: .65rem;
  overflow: scroll;
}
/*单个列表li样式*/
.list:nth-child(1),.list:nth-child(2),.list:nth-child(3),.list:nth-child(4),.list:nth-child(5),.list:nth-child(6){
  margin-top: 0;
}
.list{
    width: 2.24rem;
    float: left;
    margin-right:.892rem;
    margin-top:1.07rem;
}
.list img{
  width: 2.24rem;
  height: 2.24rem;

}
.list:nth-child(6n){
  margin-right: 0
}
.list .name{
  height:.3rem;
  line-height: .3rem;
}
.list .infoBox{
  height: .3rem;
  line-height: .3rem;
  border:.02rem solid white;
}
.infoBox span{
  padding:0 .05rem;
}
/*下一页按钮*/
.next{
  width: .3rem;
  height: .17rem;
  top:10rem;
  left: 0;
  right: 0;
  margin:0 auto;
}
</style>
